home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / RTPC10 / CLICK.PAS < prev    next >
Pascal/Delphi Source File  |  1993-11-20  |  3KB  |  69 lines

  1. {
  2.   ┌────────┬──────────────────────────────────────────────────────┐
  3.   │Name    │ CLICK.PAS                                            │
  4.   ├────────┼──────────────────────────────────────────────────────┤
  5.   │Use     │ Just an example program for TP6 and above.           │
  6.   │        │ A TSR that clicks each time a key is pressed.        │
  7.   ├────────┼──────────────────────────────────────────────────────┤
  8.   │By      │ Rafe Aldridge - (C) Copyright 1993                   │
  9.   └────────┴──────────────────────────────────────────────────────┘
  10.   ┌───────────────────────────────────────────────────────────────┐
  11.   │ Please realise that this program present's an idea. No claim  │
  12.   │ is made that it is well written or cannot be improved upon    │
  13.   └───────────────────────────────────────────────────────────────┘
  14.   ┌───────────────────────────────────────────────────────────────┐
  15.   │ Rafe's TP Collection is SHAREWARE                             │
  16.   ├───────────────────────────────────────────────────────────────┤
  17.   │                                                               │
  18.   │ If you find any part of Rafe's TP Collection usefull then     │
  19.   │ please become a registered user by sending 10 Pounds Sterling │
  20.   │ to the address below. In return you will recieve the LATEST   │
  21.   │ FULL source code to ALL the units as well anything new.       │
  22.   │                                                               │
  23.   │ Please feel free to write with suggestions, ideas or money to │
  24.   │     Rafe Aldridge,                                            │
  25.   │     Street Farm,                                              │
  26.   │     Dereham Road,                                             │
  27.   │     Garvestone,                                               │
  28.   │     Norfolk.                                                  │
  29.   │     NR9 4QT                                                   │
  30.   │     ENGLAND                                                   │
  31.   │                                                               │
  32.   └───────────────────────────────────────────────────────────────┘
  33. }
  34.  
  35. { ---------------------------------------------------------------------- }
  36. { NOTES:                                                                 }
  37. { o A TP interrupt proc disables interrupts. Hence the need for an STI.  }
  38. { o An interrupt proc must not last more than 50mS. If it will last      }
  39. {   longer then a busy flag must be used to stop recursion.              }
  40. { o This program also demonstrates how to keep data in the code segment. }
  41. { ---------------------------------------------------------------------- }
  42.  
  43. {$M 1024,0,0} { reserve stack memory }
  44.  
  45. {R-,S-,D-,L-} { turn off stack checking etc. }
  46.  
  47. Uses CRT,DOS; { libraries for sound and for getintvec and setintvec }
  48.  
  49. Procedure KEY_VEC; Assembler; ASM; DB 0,0,0; End;
  50.  
  51. Procedure KEYBOARD; Interrupt;
  52. Begin
  53.   Asm { use built in assmblr to call old key routine }
  54.     Pushf
  55.     Call DWord Ptr CS:[KEY_VEC]
  56.   End;
  57.   Sound (50); { do click sound using TP functions }
  58.   Delay (2);
  59.   NoSound;
  60.   Asm
  61.     STI; { enable interrupts as TP proc turned them off }
  62.   End;
  63. End;
  64.  
  65. Begin
  66.   GetIntVec (9,Pointer(@KEY_VEC^)); { get old vector }
  67.   SetIntVec (9,@KEYBOARD);  { point vector to our routine }
  68.   Keep(0);
  69. End.